home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SPACE 1
/
SPACE - Library 1 - Volume 1.iso
/
games
/
54
/
stcastle.bas
< prev
next >
Wrap
BASIC Source File
|
1987-04-09
|
11KB
|
321 lines
1000 ' Area Formula Castle Builder
1010 ' by Tracy and Lori Hershey
1020 ' (c) 1986 Antic Publishing, Inc.
1030 ' ST version by Bill Marquardt
1040 ' version 070286
1050 '
1060 '---------------------------------------------------------
1070 BASICON=0: BASICOFF=1: FALSE=0: TRUE=1: NONE=0: BELL$=chr$(7)
1080 dim YMIN( 9 ),YMAX( 9 ): gosub INIT
1090 poke GEMFLAG,BASICOFF
1100 TITLE$=" CASTLE GAME "
1110 gosub NEWTITLE
1120 poke GEMFLAG,BASICON
1130 MORE=TRUE
1140 '
1150 while MORE=TRUE
1160 restore CASTLE.DATA
1170 gosub INTRO
1180 gosub START
1190 '
1200 DRAW.CASTLE:
1210 color 1,8,1: clearw 2
1220 for I =1 to 12
1230 read X1,Y1,X2,Y2
1240 linef X1,Y1,X2,Y1: linef X2,Y1,X2,Y2
1250 linef X2,Y2,X1,Y2: linef X1,Y2,X1,Y1
1260 next I
1270 for I=1 to 4
1280 read X1,Y1,X2,Y2,X3,X4
1290 linef X1,Y2,X2,Y1: linef X2,Y1,X3,Y1
1300 linef X3,Y1,X4,Y2: linef X4,Y2,X1,Y2
1310 next I
1320 for I=1 to 2
1330 read X1,Y1,X2,Y2,Y3,Y4
1340 linef X1,Y2,X2,Y1: linef X2,Y1,X2,Y3
1350 linef X2,Y3,X1,Y4: linef X1,Y4,X1,Y2
1360 next I
1370 for I=1 to 4
1380 read X1,Y1,X2,Y2,X3,X4
1390 linef X1,Y2,X2,Y1: linef X2,Y1,X4,Y1
1400 linef X4,Y1,X3,Y2: linef X3,Y2,X1,Y2
1410 next I
1420 linef 83,20,83,0: linef 83,0,100,5
1430 linef 100,5,83,10
1440 for I=1 to 2
1450 read X1,Y1,X2,Y2: linef X1,Y1,X2,Y2
1460 linef X2,Y2,X1,Y2: linef X1,Y2,X1,Y1
1470 next I
1480 for I=1 to 4
1490 read X,Y,R
1500 circle X,Y,R
1510 next I
1520 for I=1 to 3
1530 read X,Y,R,A1,A2,X1,X2
1540 circle X,Y,R,A1,A2: linef X1,Y,X2,Y
1550 next I
1560 '
1570 ON ITEM gosub DO.SHAPES, DO.FORMULAS
1580 '
1590 DRAW.MENU.BOXES:
1600 color 1,0,1+ITEM
1610 X1=170: X2=300
1620 for I=1 to 8
1630 read Y1,Y2
1640 linef X1,Y1,X2,Y1: linef X2,Y1,X2,Y2
1650 next I
1660 color 1,8,1: fill 0,0: fill 100,0
1670 '
1680 '- - - - - - - - - - - - - - - - - - - - - - - - - -
1690 MAIN:
1700 NUM.WRONG=NONE
1710 XMIN=170: XMAX=300: NUM.CHOICES=7
1720 for I=1 to NUM.CHOICES
1730 YMIN(I)=32+(I*9): YMAX(I)=YMIN(I)+9
1740 next I
1750 for DRAW=1 to NUM.SHAPES
1760 RESPONSE=FALSE
1770 read SHAPE: gosub ERASE.SHAPE
1780 on SHAPE gosub DREC,DSQR,DPAR,DCIR,DTRA,DSEM,DTRI
1790 while RESPONSE=FALSE
1800 ITEM=NONE
1810 gosub GETBUTTON: if ITEM=SHAPE then RESPONSE=TRUE
1820 if(RESPONSE=FALSE)and(ITEM<>NONE)then gosub WRONG.ANS
1830 wend
1840 if RESPONSE=TRUE then ? BELL$;: color 1,COLR,1: fill XF,YF
1850 next DRAW
1860 gosub FINISH
1870 wend
1880 end
1890 '
1900 '---------------------------------------------------------
1910 FINISH:
1920 gosub ERASE.SHAPE
1930 gotoxy 19,10: ? " "
1940 gotoxy 19,10: ? "You missed ";NUM.WRONG;"."
1950 gotoxy 19,11: ? " "
1960 if NUM.WRONG=NONE then gotoxy 19,11:? " VERY good! "
1970 gotoxy 19,12: ? " Try again? "
1980 gotoxy 24,14: ? "NO ":gotoxy 24,16: ? "YES"
1990 color 1,2,2: linef 210,126,245,126: linef 245,126,245,136
2000 linef 245,136,210,136: linef 210,136,210,126
2010 color 1,3,3: linef 210,144,245,144: linef 245,144,245,154
2020 linef 245,154,210,154: linef 210,154,210,144
2030 YMIN(1)=148: YMAX(1)=158: YMIN(2)=166: YMAX(2)=176
2040 XMIN=210: XMAX=245: NUM.CHOICES=2: ITEM=NONE
2050 while ITEM=NONE: gosub GETBUTTON: wend
2060 if ITEM=1 then MORE=FALSE
2070 return
2080 '
2090 '---------------------------------------------------------
2100 WRONG.ANS:
2110 gotoxy 23,0: ? "SORRY!";
2120 SOUND 1,15,12,3,20: SOUND 1,0,0,0,0
2130 for DELAY=1 to 1000: next DELAY
2140 gotoxy 23,0: ? " "
2150 color 1,8,1: fill 230,5: NUM.WRONG=NUM.WRONG+1
2160 return
2170 '
2180 '---------------------------------------------------------
2190 DREC:
2200 read COLR,X1,Y1,X2,Y2,XF,YF
2210 linef X1,Y1,X2,Y1: linef X2,Y1,X2,Y2
2220 linef X2,Y2,X1,Y2: linef X1,Y2,X1,Y1
2230 return
2240 '
2250 DSQR:
2260 gosub DREC
2270 return
2280 '
2290 DPAR:
2300 read COLR,X1,Y1,X2,Y2,Y3,Y4,XF,YF
2310 linef X1,Y2,X2,Y1: linef X2,Y1,X2,Y3
2320 linef X2,Y3,X1,Y4: linef X1,Y4,X1,Y2
2330 return
2340 '
2350 DCIR:
2360 read COLR,XC,YC,RAD,XF,YF
2370 circle XC,YC,RAD
2380 return
2390 '
2400 DTRA:
2410 read COLR,X1,Y1,X2,Y2,X3,X4,XF,YF
2420 linef X1,Y2,X2,Y1: linef X2,Y1,X3,Y1
2430 linef X3,Y1,X4,Y2: linef X4,Y2,X1,Y2
2440 return
2450 '
2460 DSEM:
2470 read COLR,XC,YC,RAD,XF,YF
2480 circle XC,YC,RAD,0,1800: linef XC-RAD,YC,XC+RAD,YC
2490 return
2500 '
2510 DTRI:
2520 read COLR,X1,Y1,X2,Y2,XF,YF
2530 linef X1,Y1,X2,Y2: linef X2,Y2,X1,Y2
2540 linef X1,Y2,X1,Y1
2550 return
2560 '
2570 '---------------------------------------------------------
2580 DO.SHAPES:
2590 gotoxy 19,2: ? " RECTANGLE "
2600 gotoxy 19,3: ? " SQUARE "
2610 gotoxy 19,4: ? " PARALLELOGRAM "
2620 gotoxy 19,5: ? " CIRCLE "
2630 gotoxy 19,6: ? " TRAPEZOID "
2640 gotoxy 19,7: ? " SEMI-CIRCLE "
2650 gotoxy 19,8: ? " TRIANGLE "
2660 gotoxy 19,10: ? "What's the name"
2670 gotoxy 19,11: ? "of this shape? "
2680 return
2690 '
2700 '---------------------------------------------------------
2710 DO.FORMULAS:
2720 gotoxy 20,2: ? " W * L "
2730 gotoxy 20,3: ? " S^2 "
2740 gotoxy 20,4: ? " B * H "
2750 gotoxy 20,5: ? " PI * R^2 "
2760 gotoxy 20,6: ? "1/2 * H *(B+T)"
2770 gotoxy 20,7: ? "1/2 * PI * R^2"
2780 gotoxy 20,8: ? " 1/2 * H * B "
2790 gotoxy 19,10: ? "Formula for area"
2800 gotoxy 19,11: ? " of this shape?"
2810 return
2820 '
2830 '---------------------------------------------------------
2840 ERASE.SHAPE:
2850 color 1,0,0: X1=171: X2=299
2860 for Y=110 to 159: linef X1,Y,X2,Y: next Y
2870 color 1,0,1
2880 return
2890 '
2900 '---------------------------------------------------------
2910 INTRO:
2920 fullw 2: clearw 2: NUM.SHAPES=32
2930 gotoxy 2,3: ? "FORMULAS"
2940 gotoxy 20,3: ? "SHAPES"
2950 gotoxy 2,5: ? "W * L = RECTANGLE"
2960 gotoxy 2,6: ? "S^2 = SQUARE"
2970 gotoxy 2,7: ? "B * H = PARALLELOGRAM"
2980 gotoxy 2,8: ? "PI * R^2 = CIRCLE"
2990 gotoxy 2,9: ? "1/2 * H * (B+T) = TRAPEZOID"
3000 gotoxy 2,10: ? "1/2 * PI * R^2 = SEMI-CIRCLE"
3010 gotoxy 2,11: ? "1/2 * H * B = TRIANGLE"
3020 gotoxy 4,14: ? "Press mouse button to play.": gosub GETBUTTON
3030 return
3040 '
3050 '---------------------------------------------------------
3060 START:
3070 clearw 2
3080 gotoxy 4,4: ? "Would you like to try: "
3090 gotoxy 8,6: ? " Shapes "
3100 gotoxy 8,8: ? " Formulas "
3110 color 2,0,2
3120 linef 80,54,172,54: linef 172,54,172,65
3130 linef 172,65,80,65: linef 80,65,80,54
3140 color 3,0,3
3150 linef 80,72,172,72: linef 172,72,172,83
3160 linef 172,83,80,83: linef 80,83,80,72
3170 color 1,0,1: ITEM=NONE: NUM.CHOICES=2: XMIN=80:XMAX=172
3180 YMIN(1)=76: YMAX(1)=87: YMIN(2)=94: YMAX(2)=105
3190 while ITEM=NONE: gosub GETBUTTON
3200 wend:return
3210 '
3220 '---------------------------------------------------------
3230 CASTLE.DATA:
3240 data 10,75,155,150,78,120,93,150,15,30,35,65,130,30,150,65
3250 data 21,12,29,20,140,20,160,30,120,20,140,30,136,12,144,20
3260 data 5,20,25,30,25,20,45,30,83,45,115,75,50,45,83,75
3270 data 10,65,15,75,35,40,125,65,130,75,150,155
3280 data 93,140,103,150,145,155,10,140,20,150,68,78
3290 data 20,40,30,35,60,55,135,35,145,40,55,60
3300 data 36,12,41,20,45,49,5,12,0,20,14,8
3310 data 120,12,115,20,129,124,151,12,156,20,160,165
3320 data 83,20,115,45,83,20,50,45
3330 data 44,95,13,66,60,13
3340 data 99,60,13,124,95,13
3350 data 44,130,13,0,1800,31,57,124,130,13,0,1800,111,137
3360 data 85,97,13,0,1800,72,98
3370 '
3380 '---------------------------------------------------------
3390 BOX.DATA:
3400 data 18,27,27,36,36,45,45,54,54,63,63,72,72,81,90,160
3410 '
3420 '---------------------------------------------------------
3430 PROGRAM.DATA:
3440 data 1,6,200,135,240,150,11,76
3450 data 4,5,212,130,13,44,95
3460 data 5,7,200,130,210,150,240,250,104,141
3470 data 1,5,200,130,240,150,79,121
3480 data 6,7,212,130,13,123,129
3490 data 5,7,200,120,220,150,240,260,21,141
3500 data 4,5,212,130,17,124,95
3510 data 6,7,223,130,17,43,129
3520 data 1,2,200,125,220,150,16,31
3530 data 3,3,200,130,210,150,110,130,21,41
3540 data 2,3,200,130,205,135,22,13
3550 data 1,1,200,125,205,150,6,21
3560 data 3,3,200,130,210,150,110,130,6,13
3570 data 5,5,200,130,220,150,240,260,15,74
3580 data 1,1,200,130,245,150,26,21
3590 data 3,3,200,130,220,150,120,140,42,13
3600 data 2,5,210,130,234,150,51,46
3610 data 7,1,200,130,240,150,75,43
3620 data 2,5,200,130,225,150,84,46
3630 data 4,6,212,130,20,66,59
3640 data 1,2,200,120,210,150,131,31
3650 data 1,1,200,125,205,145,121,21
3660 data 3,3,200,130,220,150,120,140,120,13
3670 data 5,5,220,150,200,130,260,240,129,74
3680 data 1,1,200,135,245,145,141,21
3690 data 7,1,200,125,220,150,84,40
3700 data 3,3,200,130,220,150,120,140,140,50
3710 data 2,3,200,140,212,150,137,13
3720 data 3,3,200,130,210,150,110,130,155,16
3730 data 4,6,230,140,18,99,60
3740 data 6,7,230,140,18,84,96
3750 data 7,2,205,130,230,150,84,6
3760 '
3770 '---------------------------------------------------------
3780 GETBUTTON:
3790 while BUTTON=NONE: gosub GETMOUSE: wend: BUTTON=NONE
3800 if (MX>XMIN) and (MX<XMAX) then gosub YCHECK
3810 return
3820 '
3830 '---------------------------------------------------------
3840 YCHECK:
3850 ITEM=NONE
3860 for I=1 to NUM.CHOICES
3870 if (MY>YMIN(I)) and (MY<YMAX(I)) then ITEM=I
3880 next I
3890 return
3900 '
3910 '---------------------------------------------------------
3920 INIT:
3930 A#=GB
3940 GINTIN=peek(A#+8)
3950 OUTHANDLE=peek(SYSTAB+8)
3960 GEMFLAG=SYSTAB+24
3970 return
3980 '
3990 '---------------------------------------------------------
4000 NEWTITLE:
4010 poke GINTIN+0,OUTHANDLE
4020 poke GINTIN+2,2
4030 S# = GINTIN+4
4040 TITLE$ = TITLE$ + chr$( 0 )
4050 poke S#,varptr(TITLE$)
4060 GEMSYS( 105 )
4070 return
4080 '
4090 '---------------------------------------------------------
4100 GETMOUSE:
4110 poke CONTRL+0,124
4120 poke CONTRL+2,0
4130 poke CONTRL+6,0
4140 vdisys( 1 )
4150 BUTTON=peek( INTOUT )
4160 MX=peek( PTSOUT+0 )
4170 MY=peek( PTSOUT+2 )
4180 return